package objects.fields;

import java.io.IOException;
import java.io.RandomAccessFile;
import objects.DataObject;
import objects.GruClass;

public class StringVariable extends DataObject {
	public String value;
	
	public StringVariable() {
		value = "";
		this.gruClass = stringClass;
	}
	
	public StringVariable( String fromValue ) {
		value = fromValue;
		this.gruClass = stringClass;
	}

	@Override
	public DataObject readValue( RandomAccessFile file ) throws IOException {
		return new StringVariable( file.readUTF() );
	}

	@Override
	public void writeValue( RandomAccessFile file ) throws IOException {
		file.writeUTF( value );
	}

	@Override
	public DataObject newObject() {
		return new StringVariable( "" );
	}

	@Override
	public String toString() {
		return value;
	}
	
	@Override
	public String toCode( String indent ) {
		return String.valueOf( value );
	}
}